<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <title>My JSP 'grouplist.jsp' starting page</title>
  <script src="${pageContext.request.contextPath }/js/xtree.js"></script>
  <link type="text/css" rel="stylesheet" href="${pageContext.request.contextPath }/css/xtree.css">

  </head>
  
  <body>
    <script type="text/javascript">
		<c:forEach var='c' items='${list }'>
	    	<c:if test='${c.depth==1 }'>
	    		var tree = new WebFXTree('${c.groupname }');
	    		tree.action = "${pageContext.request.contextPath}/servlet/FindContactInfoServlet?groupid=${c.groupid}";
	    		tree.target = "right";
	    	</c:if>
	    	
	    	<c:if test='${c.depth==2 }'>
	    		var node${c.depth } = new WebFXTreeItem('${c.groupname }');
	    		tree.add(node${c.depth });
	    		node${c.depth }.action = "${pageContext.request.contextPath}/servlet/FindContactInfoServlet?groupid=${c.groupid}";
	    		node${c.depth }.target = "right";
	    	</c:if>
	    	
	    	<c:if test='${c.depth>2 }'>
	    		var node${c.depth } = new WebFXTreeItem('${c.groupname }');
	    		node${c.depth-1 }.add(node${c.depth });
	    		node${c.depth }.action = "${pageContext.request.contextPath}/message.jsp";
	    		node${c.depth }.target = "right";
	    	</c:if>
	    	
	    </c:forEach>
	    document.write(tree);
    </script>
  </body>
</html>